Skip to content

fix: parse flat selectors in linear time (backport of 62b1917 to 6.x) - #346

Merged
MoOx merged 1 commit into
postcss:6.x.xfrom
bradyshutt:backport-flat-selector-complexity
Oct 19, 2026
Merged

MoOx merged 1 commit into
postcss:6.x.xfrom
bradyshutt:backport-flat-selector-complexity

Conversation

@bradyshutt

@bradyshutt bradyshutt commented Oct 13, 2026 •

Copy link
Copy Markdown

Closes #344.

Backports 62b1917 (the GHSA-rj75-hqrm-r3gf fix in 7.1.6) to 6.x.x. Same change, reformatted for this branch and with the regression tests ported to ava.

For us this is a Dependabot finding from Tailwind 3's build-time use. A 6.x release would let us clear it without forcing Tailwind 3 onto parser 7.

Testing:

  • npm test passes (780 tests, 7 new). The new tests fail on the old parser.
  • astSync('.a'.repeat(60000)): ~4.3s on 6.1.4, ~90ms with this change.
  • Parsed 200k random selectors with both 6.1.4 and this branch: identical results for every one.

Could this go out as 6.1.5? Thanks!

@bradyshutt
bradyshutt force-pushed the backport-flat-selector-complexity branch from 08a4fee to 2a07850 Compare October 13, 2026 23:55
@bradyshutt
bradyshutt marked this pull request as ready for review October 14, 2026 00:19
@lorand-horvath

Copy link
Copy Markdown

@MoOx Please merge this and release as 6.1.5. Thanks!

@MoOx
MoOx merged commit 70b0779 into postcss:6.x.x Oct 19, 2026
@MoOx

MoOx commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks ! 6.1.5 is out. I will update the GHSA accordingly.

@lorand-horvath

Copy link
Copy Markdown

@MoOx GHSA-rj75-hqrm-r3gf should also be updated.

@MoOx

MoOx commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Already done in GHSA-rj75-hqrm-r3gf but that wasn't enough. Done via github/advisory-database#10456

thc1006 added a commit to thc1006/sch001-108platform that referenced this pull request Oct 26, 2026
2026-10-26 時 @tailwindcss/typography 最新的 0.5.20 固定相依 postcss-selector-parser 6.0.10,
在 GHSA-rj75-hqrm-r3gf 的受影響範圍內。package.json 加上 overrides
"postcss-selector-parser@<6.1.5": "^6.1.5":只在相依方要求的範圍含 6.1.5 以前的版本時才套用,
typography 之後改要 7.x 時不會被換回 6.x。6.1.5 由維護者在 2026-10-19T15:02:08Z 發布,內容是
7.1.6 修正的 backport(postcss/postcss-selector-parser#346),已滿 .npmrc 的
min-release-age=7。7.1.6 在另一個 major,所以不用它。

2026-10-26 15:08–15:12Z 查詢的結果:
- GitHub Advisory Database:受影響範圍是 >= 7.0.0, < 7.1.6 與 < 6.1.5,updated_at
  2026-10-26T14:07:57Z。
- 維護者的 repository advisory:同樣兩段,修正版 7.1.6 與 6.1.5。
- OSV:同樣兩段;用版本查,6.1.5 沒有命中,6.0.10 命中。
- npm 的 audit 資料仍只寫 <7.1.6,npm audit 照樣把 6.1.5 列為有漏洞。
- Dependabot alert #37 回 HTTP 410(Alert number 37 has been withdrawn),依 open、
  dismissed、fixed、auto_dismissed 列出也找不到這個套件的 alert。

在 min-release-age=7 下跑 npm install,package-lock.json 只改 postcss-selector-parser 一筆的
version、resolved、integrity(6.0.10 → 6.1.5),相依 cssesc、util-deprecate 不變;把 override
的 key 加上版本範圍之後 lock 不變。main 與這個 commit 各跑一次 build:deployable,dist 的 213 個
檔案只有 build-info.json 不同(它記的是 commit);typography 產生的 .prose 規則在 BaseLayout 的
CSS 裡,建置確實用到這個套件。

SECURITY.md 那一段照上面的現況改寫,拿掉「已關閉為 tolerable_risk」與等 6.1.5 收進 GHSA 的計畫。

Refs #166
thc1006 added a commit to thc1006/sch001-108platform that referenced this pull request Oct 26, 2026
2026-10-26 時 @tailwindcss/typography 最新的 0.5.20 固定相依 postcss-selector-parser 6.0.10,
在 GHSA-rj75-hqrm-r3gf 的受影響範圍內。package.json 加上 overrides
"postcss-selector-parser@<6.1.5": "^6.1.5":只在相依方要求的範圍含 6.1.5 以前的版本時才套用,
typography 之後改要 7.x 時不會被換回 6.x。6.1.5 由維護者在 2026-10-19T15:02:08Z 發布,內容是
7.1.6 修正的 backport(postcss/postcss-selector-parser#346),已滿 .npmrc 的
min-release-age=7。7.1.6 在另一個 major,所以不用它。

2026-10-26 15:08–15:12Z 查詢的結果:
- GitHub Advisory Database:受影響範圍是 >= 7.0.0, < 7.1.6 與 < 6.1.5,updated_at
  2026-10-26T14:07:57Z。
- 維護者的 repository advisory:同樣兩段,修正版 7.1.6 與 6.1.5。
- OSV:同樣兩段;用版本查,6.1.5 沒有命中,6.0.10 命中。
- npm 的 audit 資料仍只寫 <7.1.6,npm audit 照樣把 6.1.5 列為有漏洞。
- Dependabot alert #37 回 HTTP 410(Alert number 37 has been withdrawn),依 open、
  dismissed、fixed、auto_dismissed 列出也找不到這個套件的 alert。

在 min-release-age=7 下跑 npm install,package-lock.json 只改 postcss-selector-parser 一筆的
version、resolved、integrity(6.0.10 → 6.1.5),相依 cssesc、util-deprecate 不變;把 override
的 key 加上版本範圍之後 lock 不變。main 與這個 commit 各跑一次 build:deployable,dist 的 213 個
檔案只有 build-info.json 不同(它記的是 commit);typography 產生的 .prose 規則在 BaseLayout 的
CSS 裡,建置確實用到這個套件。

SECURITY.md 那一段照上面的現況改寫,拿掉「已關閉為 tolerable_risk」與等 6.1.5 收進 GHSA 的計畫。

Refs #166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants